<template>
  <div class="conten">
    <div class="head">
      <div class="kong">
        <h3>维修单处理</h3>
        <el-form ref="form" :model="form" label-width="120px">
          <el-row>
            <el-col :span="12">
              <el-form-item label="物品名称:"> 123123 </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="物品位置:"> 234234 </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="归属部门:"> 34345 </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="损坏时间:"> 456456 </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="描述:"> 567567 </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-form label-width="120px">
          <el-form-item label="损坏物品图片:">
            <div class="demo-image__preview">
              <el-image
                style="width: 100px; height: 100px"
                :src="url"
                :preview-src-list="srcList"
              >
              </el-image>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="foot">
      <el-collapse v-model="activeNames" @change="handleChange2">
        <el-collapse-item title="提交处理" name="2">
          <div class="foo">
            <div class="k"></div>
            <el-form label-width="120px">
              <el-form-item label="上传完成图片:">
                <el-upload
                  :action="updataUrl"
                  list-type="picture-card"
                  :on-preview="handlePictureCardPreview"
                  :on-remove="handleRemove"
                >
                  <i class="el-icon-plus"></i>
                </el-upload>
                <el-dialog :visible.sync="dialogVisible">
                  <img width="100%" :src="dialogImageUrl" alt="" />
                </el-dialog>
              </el-form-item>

              <el-form-item label="操作:">
                <el-radio-group v-model="radio">
                  <el-radio label="1">已处理</el-radio>
                  <el-radio label="2">驳回不处理</el-radio>
                </el-radio-group>
              </el-form-item>

              <el-form-item label="描述:">
                <el-input
                  type="textarea"
                  v-model="form.desc"
                  style="width: 60%"
                ></el-input>
              </el-form-item>

              <center>
                <el-form-item label-width="0px" style="width: 30%">
                  <el-button @click="down">关闭</el-button>
                  <el-button type="primary" @click="onSubmit"
                    >提交处理</el-button
                  >
                </el-form-item>
              </center>
            </el-form>
          </div>
        </el-collapse-item></el-collapse
      >
    </div>
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';
// id = this.$router.query.id;
import {
  getRepairOrder
} from "@/api/workflow/repairOrderProcessing";
import { getDetail } from "@/api/workflow/itemRepair";
export default {
  // import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // 这里存放数据
    //
    return {
      // id: "",
      url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      srcList: [
        "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
        "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
      ],
      activeNames: ["1"],
      radio: "1",
      updataUrl: process.env.VUE_APP_BASE_API + "/test/uploadImage",
      dialogImageUrl: "",
      dialogVisible: false,
      form: {
        name: "",
      },
      activities: [
        {
          content: "张三提交",
          timestamp: "2018-04-15",
        },
        {
          content: "李四确认损坏跟进处理",
          timestamp: "2018-04-13",
        },
        {
          content: "处理完成通知相关人员",
          timestamp: "2018-04-11",
        },
      ],
    };
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 方法集合
  methods: {
    handleChange(val) {
      console.log(val);
    },
    handleChange2(val) {
      console.log(val);
    },
    down() {
      this.$router.push("itemRepair");
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    //提交创建维修单
    onSubmit() {},
    //页面数据初始化
    detail() {
      console.log(this.$route.query.processId)
      getDetail(this.$route.query.processId).then((res) => {
        console.log(res,"123");
      });
    },
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {
   this.$router.query.processId 
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.detail();
  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {}, // 如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='scss' scoped>
.head {
  width: 96%;
  margin: 0 auto;
}

.k {
  height: 20px;
}

.body {
  width: 96%;
  margin: 0 auto;
  border: 1px solid #cccccc;
}

.foot {
  width: 96%;
  margin: 0 auto;
  margin-top: 20px;
  border: 1px solid #cccccc;
}

.el-collapse-item__header {
  background-color: #cccccc;
}
</style>
